﻿package com.moonshineproject.text.events 
{
	import flash.events.Event;
	
	import com.moonshineproject.text.change.TextChangeBase;
	
	public class ChangeEvent extends Event
	{
		public static const TEXT_CHANGE:String = "textChange";
		
		public static const ORIGIN_LOCAL:String = "local";
		public static const ORIGIN_UNDO:String = "undo";
		public static const ORIGIN_REMOTE:String = "remote";
		
		private var _change:TextChangeBase;
		private var _origin:String;
		
		public function get change():TextChangeBase	{ return _change; }
		public function get origin():String			{ return _origin; }
		
		public function ChangeEvent(type:String, change:TextChangeBase, origin:String = ORIGIN_LOCAL) 
		{
			super(type, false, false);
			
			_change = change;
			_origin = origin;
		}
		
		public override function clone():Event
		{
			return new ChangeEvent(type, change, origin);
		}
		
	}

}